package com.bzchao.oauth.service.impl;

import com.bzchao.oauth.bean.SysRole;
import com.bzchao.oauth.bean.SysRoleExample;
import com.bzchao.oauth.mapper.SysRoleMapper;
import com.bzchao.oauth.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class SysRoleServiceImpl implements RoleService {
    @Autowired
    private SysRoleMapper dao;

    @Override
    public boolean add(SysRole role) {
        dao.insert(role);
        return true;
    }

    @Override
    public boolean update(SysRole role) {
        dao.updateByPrimaryKey(role);
        return true;
    }

    @Override
    public SysRole get(String uuid) {
        return dao.selectByPrimaryKey(uuid);
    }

    @Override
    public List<SysRole> list() {
        return dao.selectByExample(new SysRoleExample());
    }

    @Override
    public List<SysRole> selectRoleByUserId(String userId) {
        return dao.selectRoleByUserId(userId);
    }

}
